package com.group.www.service.impl;

import com.group.www.dao.impl.MessageInfoDao;
import com.group.www.interfaces.Imessageinfo_q;
import com.group.www.pojo.MessageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@com.alibaba.dubbo.config.annotation.Service
@Service
public class SimpleIMessageinfo_qService implements Imessageinfo_q{

    @Autowired
    private MessageInfoDao messageInfoDao;

    @Override
    public List<MessageInfo> querymessageInfoByUserId(Integer userId) {
        return this.messageInfoDao.querymessageInfoByUserId(userId);
    }

    @Override
    public List<MessageInfo> querymessageInfoByBrandId(Integer brandId) {
        return this.messageInfoDao.querymessageInfoByBrandId(brandId);
    }

    @Override
    public boolean add(MessageInfo messageInfo) {
        this.messageInfoDao.save(messageInfo);
        return true;
    }

    @Override
    public boolean add(Object entity) {
        if(entity instanceof MessageInfo) {
            return this.add((MessageInfo) entity);
        }
        return false;
    }

    @Override
    public boolean update(Object entity) {
        if(entity instanceof MessageInfo){
            this.messageInfoDao.update((MessageInfo)entity);
            return true;
        }
        return false;
    }

    @Override
    public List query() {
        return this.messageInfoDao.queryAll();
    }

    @Override
    public boolean delete(Object entity) {
        if(entity instanceof MessageInfo){
            this.messageInfoDao.delete((MessageInfo)entity);
        }
        return false;
    }
    /******/

}
